import os

# 获取当前文件所在的目录
current_file_path = os.path.dirname(os.path.abspath(__file__))
print(current_file_path)

# 构建文件路径
file_path = os.path.join(current_file_path, "test.txt")
print(file_path)

# 写入文件
with open(file_path, "w") as f:
    f.write("hello world")


# 读取文件
with open(file_path, "r") as f:
    f.seek(5,0)
    content = f.read()
    print(content)